import StorageManager from '@/utils/StorageManager';
import { UserOutlined } from '@ant-design/icons';
import { history } from '@umijs/max';
import { Avatar, Tooltip } from 'antd';
import React from 'react';
import styles from './index.less';
export type SiderTheme = 'light' | 'dark';

const MenuFooterRender: React.FC = () => {
  const userName: string =
    StorageManager.getLocalStorageSync('userName') || '小明';

  const handleOut = () => {
    StorageManager.removeLocalStorageSync('userName');
    history.push('/login');
  };

  return (
    <Tooltip
      placement="right"
      title={
        <div className={styles.logoOut} onClick={handleOut}>
          退出登录
        </div>
      }
      color="#fff"
    >
      <div className={styles.content}>
        <Avatar size={32} className={styles.icon} icon={<UserOutlined />} />
        <span className={styles.name}>{userName}</span>
      </div>
    </Tooltip>
  );
};
export default MenuFooterRender;
